package cn.cuilan.service;

import cn.cuilan.entity.PositionProvince;
import cn.cuilan.repository.PositionProvinceRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 省份服务层实现类
 *
 * @author zhangyue
 */
@Service
public class PositionProvinceService {

    private final PositionProvinceRepository positionProvinceRepository;

    @Autowired
    public PositionProvinceService(PositionProvinceRepository positionProvinceRepository) {
        this.positionProvinceRepository = positionProvinceRepository;
    }

    /**
     * 根据国家 id 查询所有省份
     *
     * @param countryId 国家id
     * @return 地理位置省份集合
     */
    public List<PositionProvince> findProvinceByCountryId(int countryId) {
        return positionProvinceRepository.findByCountryId(countryId);
    }

}
